import request from '@/utils/request'

// 获取产品集合列表
export function proCollectionList(data) {
    return request({
        url: '/system/commodityCollection/list',
        method: 'get',
        params: data
    })
}

// 产品集合增加
export function proCollectionAdd(data) {
    return request({
        url: '/system/commodityCollection/insert',
        method: 'post',
        data: data
    })
}

// 产品集合编辑
export function proCollectionEdit(data) {
    return request({
        url: '/system/commodityCollection/update',
        method: 'post',
        data: data
    })
}

// 删除产品集合
export function proCollectionDel(id) {
    return request({
        url: '/system/commodityCollection/deleteById?id=' + id,
        method: 'get'
    })
}

// 获取产品集合详细信息
export function proCollectionDetail(id) {
    return request({
        url: '/system/commodityCollection/selectOne?id=' + id,
        method: 'get'
    })
}

// 删除单个产品
export function productDel(id) {
    return request({
        url: '/system/commodityCollectionDetail/deleteById?id=' + id,
        method: 'get'
    })
}

// 商城产品
export function storeList(data) {
    return request({
        url: '/system/commodityCollection/specificationList',
        method: 'get',
        params: data
    })
}

// 产品集合所有产品
export function storeAllList(data) {
    return request({
        url: '/system/commodityCollectionDetail/collectData',
        method: 'get',
        params: data
    })
}

// 立即购买
export function cartBuy(data) {
    return request({
        url: '/system/purchaseOrder/addPurchaseOrder',
        method: 'post',
        data: data
    })
}

// 加入购物车
export function cartAdd(data) {
    return request({
        url: '/system/shoppingCart/add',
        method: 'post',
        data: data
    })
}

// 购物车列表
export function cartList(data) {
    return request({
        url: '/system/shoppingCart/list',
        method: 'get',
        params: data
    })
}

// 购物车编辑
export function cartEdit(data) {
    return request({
        url: '/system/shoppingCart/edit',
        method: 'post',
        data: data
    })
}

// 购物车删除
export function cartDel(id) {
    return request({
        url: '/system/shoppingCart/remove?id=' + id,
        method: 'get',
    })
}

// 清空购物车
export function cartDelAll() {
    return request({
        url: '/system/shoppingCart/removeAll',
        method: 'get',
    })
}

// 确认购买
export function cartConfirm(data) {
    return request({
        url: '/system/purchaseOrder/confirm',
        method: 'post',
        data: data
    })
}